﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:controlsPrimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls"
    
    xmlns:local="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows"
    xmlns:localprimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"
    xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input" 
    xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Parameters.xaml"/>
        <ResourceDictionary Source="Brushes.xaml"/>
        <ResourceDictionary Source="CoreStyles.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    
    <!--datagrid-->
    <Style TargetType="local:DataGrid">
        <Setter Property="FontFamily" Value="{StaticResource FontFamily1}"/>
        <Setter Property="FontSize" Value="{StaticResource FontSize1}"/>
        <Setter Property="RowBackground" Value="{StaticResource Brush5}" />
        <Setter Property="AlternatingRowBackground" Value="{StaticResource Brush16}" />
        <Setter Property="Background" Value="{StaticResource Brush1}" />
        <Setter Property="HeadersVisibility" Value="Column" />
        <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="SelectionMode" Value="Extended" />
        <Setter Property="CanUserReorderColumns" Value="True" />
        <Setter Property="CanUserResizeColumns" Value="True" />
        <Setter Property="CanUserSortColumns" Value="True" />
        <Setter Property="AutoGenerateColumns" Value="True" />
        <Setter Property="RowDetailsVisibilityMode" Value="VisibleWhenSelected" />
        <Setter Property="BorderBrush" Value="{StaticResource Brush4}"/>
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="DragIndicatorStyle">
            <Setter.Value>
                <!-- TODO: Change the TargetType to Control when the fix Jolt bugs 18719 is verified -->
                <Style TargetType="ContentControl">
                    <Setter Property="Foreground" Value="#7FFFFFFF" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <!-- TODO: Change the TargetType to Control when the fix Jolt bugs 18719 is verified -->
                            <ControlTemplate TargetType="ContentControl">
                                <Grid>
                                    <vsm:VisualStateManager.VisualStateGroups>
                                        <vsm:VisualStateGroup x:Name="SortStates">
                                            <vsm:VisualState x:Name="Unsorted" />
                                            <vsm:VisualState x:Name="SortAscending">
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetName="SortIcon" Storyboard.TargetProperty="Opacity" Duration="0" To="1.0"/>
                                                </Storyboard>
                                            </vsm:VisualState>
                                            <vsm:VisualState x:Name="SortDescending">
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetName="SortIcon" Storyboard.TargetProperty="Opacity" Duration="0" To="1.0"/>
                                                    <DoubleAnimation Storyboard.TargetName="SortIcon" Storyboard.TargetProperty="(RenderTransform).ScaleY" Duration="0" To="-.9"/>
                                                </Storyboard>
                                            </vsm:VisualState>
                                        </vsm:VisualStateGroup>
                                    </vsm:VisualStateManager.VisualStateGroups>

                                    <Rectangle x:Name="BackgroundRectangle" Stretch="Fill" Fill="#66808080" Grid.ColumnSpan="2" />

                                    <Rectangle x:Name="BackgroundGradient" Stretch="Fill" Grid.ColumnSpan="2" Opacity="0" >
                                        <Rectangle.Fill>
                                            <LinearGradientBrush StartPoint=".7,0" EndPoint=".7,1">
                                                <GradientStop Color="#FFFFFFFF" Offset="0.015" />
                                                <GradientStop Color="#F9FFFFFF" Offset="0.375" />
                                                <GradientStop Color="#E5FFFFFF" Offset="0.6" />
                                                <GradientStop Color="#C6FFFFFF" Offset="1" />
                                            </LinearGradientBrush>
                                        </Rectangle.Fill>
                                    </Rectangle>

                                    <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition/>
                                            <ColumnDefinition Width="Auto" />
                                        </Grid.ColumnDefinitions>

                                        <ContentPresenter Content="{TemplateBinding Content}"/>

                                        <Path Grid.Column="1" Name="SortIcon" Fill="#7FFFFFFF" RenderTransformOrigin=".5,.5" HorizontalAlignment="Left" VerticalAlignment="Center" Opacity="0" Stretch="Uniform" Width="8" Margin="4,0,0,0" Data="F1 M -5.215,6.099L 5.215,6.099L 0,0L -5.215,6.099 Z ">
                                            <Path.RenderTransform>
                                                <ScaleTransform ScaleX=".9" ScaleY=".9" />
                                            </Path.RenderTransform>
                                        </Path>
                                    </Grid>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="DropLocationIndicatorStyle">
            <Setter.Value>
                <Style TargetType="ContentControl">
                    <Setter Property="Background" Value="#FF3F4346"/>
                    <Setter Property="Width" Value="2"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="ContentControl">
                                <Rectangle Fill="{TemplateBinding Background}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"/>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="GridLinesVisibility" Value="Vertical" />
        <Setter Property="HorizontalGridLinesBrush" Value="{StaticResource Brush1}" />
        <Setter Property="IsTabStop" Value="True" />
        <Setter Property="VerticalGridLinesBrush" Value="{StaticResource Brush1}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DataGrid">
                    <Grid x:Name="root">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal"/>
                                <vsm:VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="root"
                                                         Storyboard.TargetProperty="Opacity"
                                                         BeginTime="0"
                                                         To="{StaticResource OpacityDisable}" Duration="0:0:0.0"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        
                        
                        <Grid Name="Root" Margin="2">
                            <Grid.Resources>
                                <ControlTemplate x:Key="TopLeftHeaderTemplate" TargetType="localprimitives:DataGridColumnHeader">
                                    <Grid Name="RootElement">
                                        <Grid.RowDefinitions>
                                            <RowDefinition/>
                                            <RowDefinition/>
                                            <RowDefinition Height="Auto" />
                                        </Grid.RowDefinitions>
                                        <Border BorderThickness="0,0,1,0" BorderBrush="{StaticResource Brush17}" CornerRadius="3 0 0 0" 
                                                Background="{StaticResource Brush1}" Grid.RowSpan="2"/>
                                    </Grid>
                                </ControlTemplate>

                                <ControlTemplate x:Key="TopRightHeaderTemplate" TargetType="localprimitives:DataGridColumnHeader">
                                    <Grid Name="RootElement">
                                        <Grid.RowDefinitions>
                                            <RowDefinition/>
                                            <RowDefinition/>
                                            <RowDefinition Height="Auto" />
                                        </Grid.RowDefinitions>
                                        <Border BorderThickness="1,0,0,0" BorderBrush="{StaticResource Brush17}"  CornerRadius="0 3 0 0"
                                                Background="{StaticResource Brush1}" Grid.RowSpan="2"/>
                                    </Grid>
                                </ControlTemplate>
                            </Grid.Resources>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition/>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition/>
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <localprimitives:DataGridColumnHeader Name="TopLeftCornerHeader" 
                                                                    Template="{StaticResource TopLeftHeaderTemplate}"
                                                                    Width="22"/>
                            <localprimitives:DataGridColumnHeadersPresenter Name="ColumnHeadersPresenter" Grid.Column="1"/>
                            <localprimitives:DataGridColumnHeader Name="TopRightCornerHeader"
                                                                    Grid.Column="2" Template="{StaticResource TopRightHeaderTemplate}" />
                                
                            <Rectangle Name="ColumnHeadersAndRowsSeparator" Grid.ColumnSpan="3" 
                                        VerticalAlignment="Bottom" Width="Auto" StrokeThickness="1" Height="1" Fill="{StaticResource Brush1}"/>

                            <localprimitives:DataGridRowsPresenter Name="RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1" />
                                
                            <Rectangle Name="BottomRightCorner" Fill="{StaticResource Brush1}" Grid.Column="2" Grid.Row="2" />
                            <Rectangle Name="BottomLeftCorner" Fill="{StaticResource Brush1}" Grid.Row="2" Grid.ColumnSpan="2" />
                            <ScrollBar Name="VerticalScrollbar" Orientation="Vertical" Grid.Column="2" Grid.Row="1" 
                                        Width="18" />

                            <Grid Grid.Column="1" Grid.Row="2">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>
                                <Rectangle Name="FrozenColumnScrollBarSpacer" />
                                <ScrollBar Name="HorizontalScrollbar" Grid.Column="1" 
                                            Orientation="Horizontal" Height="18" />
                            </Grid>

                            <dataInput:ValidationSummary Name="ValidationSummary" Grid.Row="3" 
                                                            Grid.ColumnSpan="3" MaxHeight="90"/>
                        </Grid>
                        <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" 
                                CornerRadius="4"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:DataGridRow">
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DataGridRow">
                    <localprimitives:DataGridFrozenGrid Name="Root" >
                        
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal"/>
                                <vsm:VisualState x:Name="NormalAlternatingRow">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="BackgroundRectangle" 
                                                         Storyboard.TargetProperty="Opacity" Duration="0" To="0"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="BackgroundRectangle" 
                                                         Storyboard.TargetProperty="Opacity" Duration="0" To=".5"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="NormalSelected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="BackgroundRectangle" 
                                                         Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="MouseOverSelected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="BackgroundRectangle" 
                                                         Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="UnfocusedSelected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="BackgroundRectangle" 
                                                         Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                                        <ColorAnimation Duration="0" Storyboard.TargetName="BackgroundRectangle" 
                                                        Storyboard.TargetProperty="(Fill).Color" To="#776969DA"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="ValidationStates">
                                <vsm:VisualState x:Name="Valid"/>
                                <vsm:VisualState x:Name="Invalid">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0" 
                                                                       Storyboard.TargetName="BackgroundRectangle" 
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Storyboard.TargetName="InvalidVisualElement" Storyboard.TargetProperty="Opacity" 
                                                         Duration="0" To="1"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>

                        <Grid.Resources>
                            <Storyboard x:Key="DetailsVisibleTransition">
                                <DoubleAnimation Storyboard.TargetName="DetailsPresenter" 
                                                 Storyboard.TargetProperty="ContentHeight" Duration="00:00:0.1" />
                            </Storyboard>
                        </Grid.Resources>

                        <Rectangle x:Name="BackgroundRectangle" Grid.RowSpan="2" Grid.ColumnSpan="2" Opacity="0"
                                   Fill="{StaticResource Brush3}" Margin="2 0" RadiusX="4" RadiusY="4"/>
                        <Rectangle x:Name="InvalidVisualElement" Grid.RowSpan="2" Grid.ColumnSpan="2" 
                                   Opacity="0" Fill="{StaticResource Brush8}" Margin="2 0" RadiusX="4" RadiusY="4"/>

                        <localprimitives:DataGridRowHeader Grid.RowSpan="3" Name="RowHeader" 
                                                           localprimitives:DataGridFrozenGrid.IsFrozen="True" />
                        <localprimitives:DataGridCellsPresenter Grid.Column="1" Name="CellsPresenter" 
                                                                localprimitives:DataGridFrozenGrid.IsFrozen="True" />
                        <localprimitives:DataGridDetailsPresenter Grid.Row="1" Grid.Column="1" Name="DetailsPresenter" />
                        <Rectangle Grid.Row="2" Grid.Column="1" Name="BottomGridLine" HorizontalAlignment="Stretch" Height="1" />
                    </localprimitives:DataGridFrozenGrid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="localprimitives:DataGridRowHeader">
        <Setter Property="Background" Value="{StaticResource Brush1}" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="SeparatorBrush" Value="{StaticResource Brush17}" />
        <Setter Property="SeparatorVisibility" Value="Collapsed"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localprimitives:DataGridRowHeader">
                    <Grid Name="Root">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="MouseOver">
                                    
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="MouseOverCurrentRowSelected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="CurrentRowGlyph" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                                        <DoubleAnimation Storyboard.TargetName="EditingRowGlyph" Storyboard.TargetProperty="Opacity" Duration="0" To="0"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="NormalCurrentRow">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="CurrentRowGlyph" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                                        <DoubleAnimation Storyboard.TargetName="EditingRowGlyph" Storyboard.TargetProperty="Opacity" Duration="0" To="0"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="NormalSelected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="CurrentRowGlyph" Storyboard.TargetProperty="Opacity" Duration="0" To="0"/>
                                        <DoubleAnimation Storyboard.TargetName="EditingRowGlyph" Storyboard.TargetProperty="Opacity" Duration="0" To="0"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="NormalEditingRow">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="CurrentRowGlyph" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                                        <DoubleAnimation Storyboard.TargetName="EditingRowGlyph" Storyboard.TargetProperty="Opacity" Duration="0" To="0"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="ValidationStates">
                                <vsm:VisualState x:Name="RowValid"/>
                                <vsm:VisualState x:Name="RowInvalid">
                                    
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>

                        <Border BorderBrush="{StaticResource Brush17}" BorderThickness="1,0,1,0" Grid.RowSpan="3" Grid.ColumnSpan="2">
                            <Grid Background="{TemplateBinding Background}">
                                <Rectangle x:Name="RowInvalidVisualElement" Stretch="Fill" Grid.RowSpan="3" 
                                           Grid.ColumnSpan="2" Fill="{StaticResource Brush8}" Opacity="0" />
                                <Rectangle x:Name="BackgroundRectangle" Stretch="Fill" Grid.RowSpan="3" 
                                           Grid.ColumnSpan="2" Fill="Transparent" />
                            </Grid>
                        </Border>
                        
                        <Rectangle Name="HorizontalSeparator" Grid.ColumnSpan="2" Grid.Row="2" Height="1"
                                   Margin="1,0,1,0" HorizontalAlignment="Stretch" Fill="{TemplateBinding SeparatorBrush}" 
                                   Visibility="{TemplateBinding SeparatorVisibility}" />

                        <ContentPresenter Content="{TemplateBinding Content}" VerticalAlignment="Center" 
                                          HorizontalAlignment="Center" Grid.Column="1" Grid.RowSpan="2" />

                        <Path Name="CurrentRowGlyph" VerticalAlignment="Center" HorizontalAlignment="Center" 
                              Width="6" Height="10"  Margin="8,0,8,0" Grid.RowSpan="2" Stretch="Fill" 
                              Opacity="0" Data="F1 M 511.047,352.682L 511.047,342.252L 517.145,347.467L 511.047,352.682 Z "
                              Fill="{StaticResource Brush17}"/>

                        <Path Name="EditingRowGlyph" VerticalAlignment="Center" 
                              HorizontalAlignment="Center" Width="6" Height="10"  Margin="8,0,8,0" 
                              Grid.RowSpan="2" Stretch="Fill" Opacity="0" 
                              Data="F1 M 511.047,352.682L 511.047,342.252L 517.145,347.467L 511.047,352.682 Z "
                              Fill="{StaticResource Brush17}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:DataGridRowGroupHeader">
        <Setter Property="Cursor" Value="Arrow" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Background" Value="{StaticResource Brush12}" />
        <Setter Property="Height" Value="{StaticResource Height1}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DataGridRowGroupHeader">
                    <localprimitives:DataGridFrozenGrid Name="Root" Background="{TemplateBinding Background}">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CurrentStates">
                                <vsm:VisualState x:Name="Regular"/>
                                <vsm:VisualState x:Name="Current">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="FocusVisual" 
                                                         Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <localprimitives:DataGridFrozenGrid.Resources>
                            <ControlTemplate x:Key="ToggleButtonTemplate" TargetType="ToggleButton">
                                <Grid Background="Transparent">
                                    <vsm:VisualStateManager.VisualStateGroups>
                                        <vsm:VisualStateGroup x:Name="CommonStates">
                                            <vsm:VisualState x:Name="Normal"/>
                                            <vsm:VisualState x:Name="MouseOver">
                                                
                                            </vsm:VisualState>
                                            <vsm:VisualState x:Name="Pressed">
                                                
                                            </vsm:VisualState>
                                            <vsm:VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimation Duration="0" Storyboard.TargetName="CollapsedArrow" 
                                                                     Storyboard.TargetProperty="Opacity" To="{StaticResource OpacityDisable}"/>
                                                    <DoubleAnimation Duration="0" Storyboard.TargetName="ExpandedArrow" 
                                                                     Storyboard.TargetProperty="Opacity" To="{StaticResource OpacityDisable}"/>
                                                </Storyboard>
                                            </vsm:VisualState>
                                        </vsm:VisualStateGroup>
                                        <vsm:VisualStateGroup x:Name="CheckStates">
                                            <vsm:VisualState x:Name="Checked" />
                                            <vsm:VisualState x:Name="Unchecked">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="CollapsedArrow" Storyboard.TargetProperty="Visibility">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ExpandedArrow" Storyboard.TargetProperty="Visibility">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </vsm:VisualState>
                                        </vsm:VisualStateGroup>
                                    </vsm:VisualStateManager.VisualStateGroups>

                                    <Path Stretch="Uniform" Data="F1 M 0,0 L 0,1 L .6,.5 L 0,0 Z" Width="5" 
                                          HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="CollapsedArrow" 
                                          Visibility="Collapsed" Stroke="{StaticResource Brush1}"/>
                                    <Path Stretch="Uniform" Data="F1 M 0,1 L 1,1 L 1,0 L 0,1 Z" Width="6" 
                                          HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="ExpandedArrow" 
                                          Fill="{StaticResource Brush1}"/>
                                </Grid>
                            </ControlTemplate>
                        </localprimitives:DataGridFrozenGrid.Resources>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <Rectangle Grid.Column="1" Grid.ColumnSpan="5" Fill="{StaticResource Brush17}" Height="0"/>
                        <Rectangle Grid.Column="1" Grid.Row="1" Name="IndentSpacer" />
                        <ToggleButton Grid.Column="2" Grid.Row="1" Name="ExpanderButton" 
                                      Height="15" Width="15" IsTabStop="False" 
                                      Template="{StaticResource ToggleButtonTemplate}" Margin="2,0,0,0"/>

                        <StackPanel Grid.Column="3" Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,1,0,1">
                            <TextBlock x:Name="PropertyNameElement" Margin="4,0,0,0" Visibility="{TemplateBinding PropertyNameVisibility}"/>
                            <TextBlock Margin="4,0,0,0" Text="{Binding Name}" />
                            <TextBlock x:Name="ItemCountElement" Margin="4,0,0,0" Visibility="{TemplateBinding ItemCountVisibility}"/>
                        </StackPanel>

                        <Rectangle Grid.Column="1" Grid.ColumnSpan="5" Fill="{StaticResource Brush17}" Height="1" Grid.Row="2"/>
                        <Rectangle Name="FocusVisual" Grid.Column="1" Grid.ColumnSpan="4" Grid.RowSpan="3" 
                                   Stroke="{StaticResource Brush15}" StrokeThickness="2" Margin="0" HorizontalAlignment="Stretch" 
                               VerticalAlignment="Stretch" IsHitTestVisible="false" Opacity="0" />
                        <localprimitives:DataGridRowHeader Name="RowHeader" Grid.RowSpan="3" 
                                                           localprimitives:DataGridFrozenGrid.IsFrozen="True"/>

                    </localprimitives:DataGridFrozenGrid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="localprimitives:DataGridColumnHeader">
        <Setter Property="Foreground" Value="{StaticResource Brush17}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="SeparatorBrush" Value="{StaticResource Brush17}" />
        <Setter Property="Padding" Value="4" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localprimitives:DataGridColumnHeader">
                    <Grid Name="Root">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="MouseOver">
                                    
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Pressed">
                                    
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="SortStates">
                                <vsm:VisualState x:Name="Unsorted" />
                                <vsm:VisualState x:Name="SortAscending">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="SortIcon" Storyboard.TargetProperty="Opacity" 
                                                         Duration="0" To="1.0"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="SortDescending">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="SortIcon" Storyboard.TargetProperty="Opacity" 
                                                         Duration="0" To="1.0"/>
                                        <DoubleAnimation Storyboard.TargetName="SortIcon" 
                                                         Storyboard.TargetProperty="(RenderTransform).ScaleY" Duration="0" To="-.9"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <Rectangle x:Name="BackgroundRectangle" Stretch="Fill" Fill="{StaticResource Brush1}" Grid.ColumnSpan="2" />

                        <Rectangle x:Name="BackgroundGradient" Stretch="Fill" Grid.ColumnSpan="2" >
                            <!--<Rectangle.Fill>
                                <LinearGradientBrush StartPoint=".7,0" EndPoint=".7,1">
                                    <GradientStop Color="#FCFFFFFF" Offset="0.015" />
                                    <GradientStop Color="#F7FFFFFF" Offset="0.375" />
                                    <GradientStop Color="#E5FFFFFF" Offset="0.6" />
                                    <GradientStop Color="#D1FFFFFF" Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>-->
                        </Rectangle>

                        <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <ContentPresenter Content="{TemplateBinding Content}"/>

                            <Path Grid.Column="1" Name="SortIcon" Fill="{StaticResource Brush17}" 
                                  RenderTransformOrigin=".5,.5" HorizontalAlignment="Left" 
                                  VerticalAlignment="Center" Opacity="0" Stretch="Uniform" Width="8"
                                  Margin="4,0,0,0" Data="F1 M -5.215,6.099L 5.215,6.099L 0,0L -5.215,6.099 Z ">
                                <Path.RenderTransform>
                                    <ScaleTransform ScaleX=".9" ScaleY=".9" />
                                </Path.RenderTransform>
                            </Path>
                        </Grid>

                        <Rectangle Name="VerticalSeparator" Grid.Column="1" Width="1" 
                                   VerticalAlignment="Stretch" Fill="{StaticResource Brush17}" 
                                   Visibility="{TemplateBinding SeparatorVisibility}" />

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:DataGridCell">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DataGridCell">
                    <Grid Name="Root" Background="{TemplateBinding Background}">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CurrentStates">
                                <vsm:VisualState x:Name="Regular" />
                                <vsm:VisualState x:Name="Current">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="FocusVisual" 
                                                         Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="ValidationStates">
                                <vsm:VisualState x:Name="Valid"/>
                                <vsm:VisualState x:Name="Invalid">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="InvalidVisualElement" 
                                                         Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <Rectangle Name="FocusVisual" Stroke="{StaticResource Brush15}" StrokeThickness="0" Margin="1"
                                   Fill="{StaticResource Brush5}" HorizontalAlignment="Stretch" RadiusX="4" RadiusY="4"
                               VerticalAlignment="Stretch" IsHitTestVisible="false" Opacity="0"/>

                        <ContentPresenter Content="{TemplateBinding Content}"
                                            ContentTemplate="{TemplateBinding ContentTemplate}"
                                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                            Margin="{TemplateBinding Padding}" />

                        <Rectangle x:Name="InvalidVisualElement" IsHitTestVisible="False" 
                                   Stroke="{StaticResource Brush8}" StrokeThickness="2" 
                                   Fill="Transparent" HorizontalAlignment="Stretch" RadiusX="4" RadiusY="4"
                                   VerticalAlignment="Stretch" Opacity="0"/>

                        <Rectangle Name="RightGridLine" Grid.Column="1" VerticalAlignment="Stretch" Width="1" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--datapager-->
    <Style TargetType="local:DataPager">
        <Setter Property="FontFamily" Value="{StaticResource FontFamily1}"/>
        <Setter Property="FontSize" Value="{StaticResource FontSize1}"/>
        <Setter Property="Foreground" Value="{StaticResource Brush2}"/>
        <Setter Property="Background" Value="{StaticResource Brush5}"/>
        <Setter Property="BorderBrush" Value="{StaticResource Brush4}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="HorizontalContentAlignment" Value="Right" />
        <Setter Property="NumericButtonStyle">
            <Setter.Value>
                <Style TargetType="ToggleButton">
                    <Setter Property="MinHeight" Value="20"/>
                    <Setter Property="MinWidth" Value="20"/>
                    <Setter Property="HorizontalAlignment" Value="Right"/>
                    <Setter Property="VerticalAlignment" Value="Center"/>
                    <Setter Property="FontFamily" Value="{StaticResource FontFamily1}"/>
                    <Setter Property="FontSize" Value="{StaticResource FontSize1}"/>
                    <Setter Property="Foreground" Value="{StaticResource Brush2}"/>
                    <Setter Property="Background" Value="{StaticResource Brush5}"/>
                    <Setter Property="BorderThickness" Value="1"/>
                    <Setter Property="Padding" Value="1"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="ToggleButton">
                                <Grid x:Name="root">
                                    <vsm:VisualStateManager.VisualStateGroups>
                                        <vsm:VisualStateGroup x:Name="CommonStates">
                                            <vsm:VisualState x:Name="Normal">
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetName="Hover"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.1" To="0"/>
                                                </Storyboard>
                                            </vsm:VisualState>
                                            <vsm:VisualState x:Name="MouseOver">
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetName="Hover"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.1" To="1"/>
                                                </Storyboard>
                                            </vsm:VisualState>
                                            <vsm:VisualState x:Name="Pressed">
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetName="Hover"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.02" To="0"/>
                                                    <DoubleAnimation Storyboard.TargetName="Click"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.02" To="1"/>
                                                </Storyboard>
                                            </vsm:VisualState>
                                            <vsm:VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetName="root"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0" To="{StaticResource OpacityDisable}"/>
                                                </Storyboard>
                                            </vsm:VisualState>
                                        </vsm:VisualStateGroup>

                                        <vsm:VisualStateGroup x:Name="CheckStates">
                                            <vsm:VisualState x:Name="Checked">
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetName="Background"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0" To="1"/>
                                                </Storyboard>
                                            </vsm:VisualState>
                                            <vsm:VisualState x:Name="Unchecked"/>
                                        </vsm:VisualStateGroup>

                                        <vsm:VisualStateGroup x:Name="FocusStates">
                                            <vsm:VisualState x:Name="Focused">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Focus"
                                                                       Storyboard.TargetProperty="Visibility">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </vsm:VisualState>
                                            <vsm:VisualState x:Name="Unfocused" />
                                        </vsm:VisualStateGroup>
                                    </vsm:VisualStateManager.VisualStateGroups>

                                    <Border Background="{StaticResource Brush3}" CornerRadius="3" x:Name="Background" Opacity="0"/>
                                    
                                    <Border x:Name="Click" CornerRadius="3" Background="{StaticResource Brush3}" Opacity="0"/>

                                    <Border x:Name="Hover" Background="{StaticResource Brush3}" CornerRadius="3" Opacity="0"/>

                                    <Border x:Name="Focus" BorderThickness="2" CornerRadius="3" 
                                            BorderBrush="{StaticResource Brush15}" Margin="0" Visibility="Collapsed"/>

                                    <ContentPresenter x:Name="contentPresenter"
                                                      Content="{TemplateBinding Content}"
                                                      ContentTemplate="{TemplateBinding ContentTemplate}"
                                                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                      Margin="{TemplateBinding Padding}"/>



                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DataPager">
                    <Grid Name="Root" >
                        <Grid.Resources>
                            <ControlTemplate x:Key="ButtonTemplate" TargetType="Button">
                                <Grid Margin="1" x:Name="root">
                                    <vsm:VisualStateManager.VisualStateGroups>
                                        <vsm:VisualStateGroup x:Name="CommonStates">
                                            <vsm:VisualState x:Name="Normal"/>
                                            <vsm:VisualState x:Name="MouseOver">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OuterBtnBorder"
                                                                                   Storyboard.TargetProperty="Background">
                                                        <DiscreteObjectKeyFrame KeyTime="0"
                                                                                Value="{StaticResource Brush3}"/>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </vsm:VisualState>
                                            <vsm:VisualState x:Name="Pressed">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OuterBtnBorder"
                                                                                   Storyboard.TargetProperty="Background">
                                                        <DiscreteObjectKeyFrame KeyTime="0"
                                                                                Value="{StaticResource Brush3}"/>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </vsm:VisualState>
                                            <vsm:VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetName="root"
                                                         Storyboard.TargetProperty="Opacity"
                                                         BeginTime="0"
                                                         To="{StaticResource OpacityDisable}" Duration="0:0:0.0"/>
                                                </Storyboard>
                                            </vsm:VisualState>
                                        </vsm:VisualStateGroup>
                                        <vsm:VisualStateGroup x:Name="FocusStates">
                                            <vsm:VisualState x:Name="Focused">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Focus"
                                                                       Storyboard.TargetProperty="Visibility">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </vsm:VisualState>
                                            <vsm:VisualState x:Name="Unfocused"/>
                                        </vsm:VisualStateGroup>
                                    </vsm:VisualStateManager.VisualStateGroups>
                                    
                                    <Border x:Name="OuterBtnBorder" Background="Transparent" CornerRadius="3">
                                        <Grid>
                                            <Border x:Name="Focus" BorderThickness="2" CornerRadius="3" 
                                                BorderBrush="{StaticResource Brush15}" Margin="0" Visibility="Collapsed"/>
                                            <ContentPresenter x:Name="path" Content="{TemplateBinding Content}"/>
                                        </Grid>
                                        
                                    </Border>
                                </Grid>
                            </ControlTemplate>

                            <Style x:Key="PagingTextBoxStyle" TargetType="TextBox">
                                <Setter Property="FontFamily" Value="{StaticResource FontFamily1}"/>
                                <Setter Property="FontSize" Value="{StaticResource FontSize1}"/>
                                <Setter Property="CaretBrush" Value="{StaticResource CaretColor}"/>
                                <Setter Property="SelectionBackground" Value="{StaticResource Brush2}"/>
                                <Setter Property="SelectionForeground" Value="{StaticResource Brush5}"/>
                                <Setter Property="BorderThickness" Value="2"/>
                                <Setter Property="Background" Value="{StaticResource Brush5}"/>
                                <Setter Property="Foreground" Value="{StaticResource Brush2}"/>
                                <Setter Property="Padding" Value="4"/>
                                <Setter Property="BorderBrush" Value="{StaticResource Brush4}"/>
                                <Setter Property="Height" Value="{StaticResource Height1}"/>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="TextBox">
                                            <Grid x:Name="RootElement">
                                                <vsm:VisualStateManager.VisualStateGroups>
                                                    <vsm:VisualStateGroup x:Name="CommonStates">
                                                        <vsm:VisualState x:Name="Normal"/>
                                                        <vsm:VisualState x:Name="MouseOver">

                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Disabled">
                                                            <Storyboard>
                                                                <DoubleAnimation Storyboard.TargetName="RootElement"
                                                                     Storyboard.TargetProperty="Opacity"
                                                                     BeginTime="0"
                                                                     To="{StaticResource OpacityDisable}" Duration="0:0:0.0"/>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="ReadOnly">

                                                        </vsm:VisualState>
                                                    </vsm:VisualStateGroup>
                                                    <vsm:VisualStateGroup x:Name="FocusStates">
                                                        <vsm:VisualState x:Name="Focused">
                                                            <Storyboard>
                                                                <DoubleAnimation Storyboard.TargetName="FocusBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         BeginTime="0"
                                                         To="1" Duration="0:0:0.0"/>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Unfocused">

                                                        </vsm:VisualState>
                                                    </vsm:VisualStateGroup>
                                                    <vsm:VisualStateGroup x:Name="ValidationStates">
                                                        <vsm:VisualState x:Name="Valid"/>
                                                        <vsm:VisualState x:Name="InvalidUnfocused">
                                                            <Storyboard>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
                                                                       Storyboard.TargetProperty="BorderBrush">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource Brush8}"/>
                                                                </ObjectAnimationUsingKeyFrames>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip"
                                                                       Storyboard.TargetProperty="Visibility">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                                                </ObjectAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="InvalidFocused">
                                                            <Storyboard>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
                                                                       Storyboard.TargetProperty="BorderBrush">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource Brush8}"/>
                                                                </ObjectAnimationUsingKeyFrames>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip"
                                                                       Storyboard.TargetProperty="Visibility">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                                                </ObjectAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                    </vsm:VisualStateGroup>
                                                </vsm:VisualStateManager.VisualStateGroups>

                                                <Border x:Name="Border" Background="{TemplateBinding Background}" 
                                BorderThickness="{TemplateBinding BorderThickness}"
                                BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="4"/>

                                                <Border x:Name="FocusBorder" BorderThickness="1" BorderBrush="{StaticResource Brush7}"
                                Margin="2" CornerRadius="2" Opacity="0"/>

                                                <ScrollViewer x:Name="ContentElement" Margin="{TemplateBinding Padding}" 
                                      BorderThickness="0" IsTabStop="False" VerticalAlignment="Center"
                                      HorizontalAlignment="Stretch"/>
                                                <ToolTipService.ToolTip>
                                                    <ToolTip x:Name="validationTooltip" Placement="Right" 
                                     VerticalOffset="-10" HorizontalOffset="10" Visibility="Collapsed"
                                         Template="{StaticResource ValidationToolTipTemplate}"
                                         PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                         DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
                                                        <TextBlock UseLayoutRounding="false" 
                                            Foreground="White" Margin="8 4" MaxWidth="150" TextWrapping="Wrap" 
                                            Text="{Binding (Validation.Errors)[0].ErrorContent}"/>
                                                    </ToolTip>
                                                </ToolTipService.ToolTip>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Grid.Resources>
                        
                        <vsm:VisualStateManager.VisualStateGroups>

                            <!-- CommonStates -->
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal"/>
                                <vsm:VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Root"
                                                         Storyboard.TargetProperty="Opacity"
                                                         BeginTime="0"
                                                         To="{StaticResource OpacityDisable}" Duration="0:0:0.0"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>

                            <!-- MoveStates -->
                            <vsm:VisualStateGroup x:Name="MoveStates">
                                <vsm:VisualState x:Name="MoveEnabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CurrentPageTextBox" Storyboard.TargetProperty="IsEnabled" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>

                                <vsm:VisualState x:Name="MoveDisabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CurrentPageTextBox" Storyboard.TargetProperty="IsEnabled" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="False"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>

                            <!-- CanPageFirstStates -->
                            <vsm:VisualStateGroup x:Name="MoveFirstStates">
                                <vsm:VisualState x:Name="MoveFirstEnabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FirstPageButton" Storyboard.TargetProperty="IsEnabled" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>

                                <vsm:VisualState x:Name="MoveFirstDisabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FirstPageButton" Storyboard.TargetProperty="IsEnabled" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="False"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>

                            <!-- CanPagePreviousStates -->
                            <vsm:VisualStateGroup x:Name="MovePreviousStates">
                                <vsm:VisualState x:Name="MovePreviousEnabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PreviousPageButton" Storyboard.TargetProperty="IsEnabled" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>

                                <vsm:VisualState x:Name="MovePreviousDisabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PreviousPageButton" Storyboard.TargetProperty="IsEnabled" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="False"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>

                            <!-- CanPageNextStates -->
                            <vsm:VisualStateGroup x:Name="MoveNextStates">
                                <vsm:VisualState x:Name="MoveNextEnabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NextPageButton" Storyboard.TargetProperty="IsEnabled" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>

                                <vsm:VisualState x:Name="MoveNextDisabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NextPageButton" Storyboard.TargetProperty="IsEnabled" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="False"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>

                            <!-- CanPageLastStates -->
                            <vsm:VisualStateGroup x:Name="MoveLastStates">
                                <vsm:VisualState x:Name="MoveLastEnabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LastPageButton" Storyboard.TargetProperty="IsEnabled" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>

                                <vsm:VisualState x:Name="MoveLastDisabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LastPageButton" Storyboard.TargetProperty="IsEnabled" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="False"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>

                            <!-- PagerDisplayModeStates -->
                            <vsm:VisualStateGroup x:Name="DisplayModeStates">
                                <vsm:VisualState x:Name="FirstLastNumeric">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NextPageButton" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PreviousPageButton" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CurrentPageTextBox" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PageDisplay" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>

                                <vsm:VisualState x:Name="FirstLastPreviousNext">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NumericButtonPanel" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>

                                <vsm:VisualState x:Name="FirstLastPreviousNextNumeric">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CurrentPageTextBox" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PageDisplay" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>

                                <vsm:VisualState x:Name="Numeric">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FirstPageButton" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LastPageButton" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NextPageButton" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PreviousPageButton" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CurrentPageTextBox" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PageDisplay" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Separator1" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Separator2" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>

                                <vsm:VisualState x:Name="PreviousNext">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FirstPageButton" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LastPageButton" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NumericButtonPanel" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>

                                <vsm:VisualState x:Name="PreviousNextNumeric">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FirstPageButton" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LastPageButton" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CurrentPageTextBox" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PageDisplay" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>

                        </vsm:VisualStateManager.VisualStateGroups>

                        <!-- DataPager Control Parts -->
                        <Border MinHeight="24" Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" 
                                VerticalAlignment="Bottom" CornerRadius="4">
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                        VerticalAlignment="Stretch">
                                <!--FirstPage Button-->
                                <Button x:Name="FirstPageButton" Height="20" Width="20"
                                        BorderThickness="1" Padding="1" HorizontalAlignment="Right" VerticalAlignment="Center" 
                                        Template="{StaticResource ButtonTemplate}">
                                    <Button.Content>
                                        <Grid Height="9" Width="8" >
                                            <Path Stretch="Fill" Data="M0,1 L1,0 L1,2 Z" Width="5" Height="9" 
                                                  HorizontalAlignment="Right" Fill="{TemplateBinding Foreground}"/>
                                            <Rectangle Width="2" HorizontalAlignment="Left" Fill="{TemplateBinding Foreground}"/>
                                        </Grid>
                                    </Button.Content>
                                </Button>

                                <!--PreviousPage Button-->
                                <Button Name="PreviousPageButton"
                                        BorderThickness="1" Padding="1" Height="20" Width="20" HorizontalAlignment="Right" 
                                        VerticalAlignment="Center" Template="{StaticResource ButtonTemplate}">
                                    <Button.Content>
                                        <Path Stretch="Fill" Data="M0,1 L1,0 L1,2 Z" Width="5" Height="9" 
                                              HorizontalAlignment="Center" Fill="{TemplateBinding Foreground}"/>
                                    </Button.Content>
                                </Button>

                                <Border x:Name="Separator1" Width="1" Background="#FFCCD1D6" BorderBrush="{TemplateBinding BorderBrush}" 
                                        BorderThickness="1,0,1,0" Margin="0,3,0,3"/>
                                <!--Numeric Button Panel-->
                                <StackPanel x:Name="NumericButtonPanel" Orientation="Horizontal" Margin="1"/>

                                <!--Page Display-->
                                <StackPanel x:Name="PageDisplay" Orientation="Horizontal">
                                    <TextBlock x:Name="CurrentPagePrefixTextBlock" Width="Auto" VerticalAlignment="Center" 
                                               Margin="4,0,0,0" Foreground="{TemplateBinding Foreground}"/>
                                    <TextBox x:Name="CurrentPageTextBox" TextWrapping="Wrap" Width="40" Height="Auto"
                                             VerticalAlignment="Center" Margin="4,2,4,2" Style="{StaticResource PagingTextBoxStyle}" 
                                             Foreground="{TemplateBinding Foreground}" BorderBrush="{TemplateBinding BorderBrush}"/>
                                    <TextBlock x:Name="CurrentPageSuffixTextBlock" Width="Auto" 
                                               VerticalAlignment="Center" Margin="0,0,4,0" Foreground="{TemplateBinding Foreground}"/>
                                </StackPanel>
                                <Border x:Name="Separator2" Width="1" Background="#FFCCD1D6" BorderBrush="{TemplateBinding BorderBrush}" 
                                        BorderThickness="1,0,1,0" Margin="0,3,0,3"/>

                                <!--NextPage Button-->
                                <Button x:Name="NextPageButton" 
                                        BorderThickness="1" Padding="1" Height="20" Width="20" HorizontalAlignment="Right" 
                                        VerticalAlignment="Center" Template="{StaticResource ButtonTemplate}">
                                    <Button.Content>
                                        <Path Stretch="Fill" Data="M0,0 L1,1 L0,2 Z" Width="5" Height="9" 
                                              HorizontalAlignment="Center" Fill="{TemplateBinding Foreground}"/>
                                    </Button.Content>
                                </Button>

                                <!--LastPage Button-->
                                <Button x:Name="LastPageButton" 
                                        BorderThickness="1" Padding="1" Height="20" Width="20" HorizontalAlignment="Right" 
                                        VerticalAlignment="Center" Template="{StaticResource ButtonTemplate}">
                                    <Button.Content>
                                        <Grid Height="9" Width="8">
                                            <Path Stretch="Fill" Data="M0,0 L1,1 L0,2 Z" Width="5" Height="9" HorizontalAlignment="Left" 
                                                  Fill="{TemplateBinding Foreground}"/>
                                            <Rectangle Width="2" HorizontalAlignment="Right" Fill="{TemplateBinding Foreground}"/>
                                        </Grid>
                                    </Button.Content>
                                </Button>
                            </StackPanel>
                        </Border>
                        
                    </Grid>                    
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--autocompletebox-->
    <Style TargetType="input:AutoCompleteBox">
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Padding" Value="2" />
        <Setter Property="FontFamily" Value="{StaticResource FontFamily1}"/>
        <Setter Property="FontSize" Value="{StaticResource FontSize1}"/>
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="Background" Value="{StaticResource Brush5}"/>
        <Setter Property="Foreground" Value="{StaticResource Brush2}"/>
        <Setter Property="Padding" Value="4"/>
        <Setter Property="BorderBrush" Value="{StaticResource Brush4}"/>
        <Setter Property="Height" Value="{StaticResource Height1}"/>
        <Setter Property="TextBoxStyle">
            <Setter.Value>
                <Style TargetType="TextBox" BasedOn="{StaticResource TextBoxBase}"/>
            </Setter.Value>
        </Setter>
        <Setter Property="MinWidth" Value="45" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="input:AutoCompleteBox">
                    <Grid Opacity="{TemplateBinding Opacity}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="PopupStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" To="PopupOpened" />
                                    <VisualTransition GeneratedDuration="0:0:0.2" To="PopupClosed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="PopupOpened">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="PopupBorder" 
                                                         Storyboard.TargetProperty="Opacity" To="1.0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="PopupClosed">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="PopupBorder" 
                                                         Storyboard.TargetProperty="Opacity" To="0.0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="true"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>

                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <TextBox Padding="{TemplateBinding Padding}"
                                 IsTabStop="True" x:Name="Text" Style="{TemplateBinding TextBoxStyle}" 
                                 BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" 
                                 Foreground="{TemplateBinding Foreground}" />

                        <Border x:Name="ValidationErrorElement" Visibility="Collapsed" BorderBrush="{StaticResource Brush8}" 
                                BorderThickness="2" CornerRadius="4">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" 
                                         Template="{StaticResource ValidationToolTipTemplate}" Placement="Right" 
                                         PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="true"/>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Height="12" HorizontalAlignment="Right" Margin="1,-4,-4,0" VerticalAlignment="Top" Width="12" Background="Transparent">
                                <Path Fill="#FFDC000C" Margin="1,3,0,0" Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z" />
                                <Path Fill="#ffffff" Margin="1,3,0,0" Data="M 0,0 L2,0 L 8,6 L8,8" />
                            </Grid>
                        </Border>

                        <Popup x:Name="Popup">
                            <Grid Opacity="{TemplateBinding Opacity}">
                                <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}" Margin="0 1 0 0"
                                    CornerRadius="4" x:Name="PopupBorder">
                                    <ListBox x:Name="Selector" ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                                                 ScrollViewer.VerticalScrollBarVisibility="Auto" 
                                                 ItemContainerStyle="{TemplateBinding ItemContainerStyle}" 
                                                 Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}" 
                                                 BorderThickness="0" ItemTemplate="{TemplateBinding ItemTemplate}" />
                                </Border>
                                
                            </Grid>
                        </Popup>

                        

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--calendar-->
    <Style TargetType="controls:Calendar">
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Background" Value="{StaticResource Brush5}"/>
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="BorderBrush" Value="{StaticResource Brush4}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:Calendar">
                    <StackPanel x:Name="Root" HorizontalAlignment="Center">
                        <controlsPrimitives:CalendarItem x:Name="CalendarItem" 
                                                         Background="{TemplateBinding Background}" 
                                                         BorderBrush="{TemplateBinding BorderBrush}" 
                                                         BorderThickness="{TemplateBinding BorderThickness}" />
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controlsPrimitives:CalendarItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controlsPrimitives:CalendarItem">
                    <Grid>
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="Disabled">
                                    
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" 
                                Background="{TemplateBinding Background}" Margin="0,2,0,2" CornerRadius="4">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="20" />
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>

                                <Grid.Resources>
                                    <ControlTemplate x:Key="HeaderButtonTemplate" TargetType="Button">
                                        <Grid Cursor="Hand">
                                            <vsm:VisualStateManager.VisualStateGroups>
                                                <vsm:VisualStateGroup x:Name="CommonStates">
                                                    <vsm:VisualState x:Name="Normal" />
                                                    <vsm:VisualState x:Name="MouseOver">
                                                        
                                                    </vsm:VisualState>
                                                    <vsm:VisualState x:Name="Disabled">
                                                        
                                                    </vsm:VisualState>
                                                </vsm:VisualStateGroup>
                                            </vsm:VisualStateManager.VisualStateGroups>

                                            <ContentControl x:Name="Content" IsTabStop="False" Foreground="{StaticResource Brush2}"
                                                            Content="{TemplateBinding Content}" 
                                                            ContentTemplate="{TemplateBinding ContentTemplate}" 
                                                            Margin="2" 
                                                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                        </Grid>
                                    </ControlTemplate>

                                    <DataTemplate x:Name="DayTitleTemplate">
                                        <TextBlock FontWeight="Bold" FontSize="10" Text="{Binding}" Margin="0 2" 
                                                   HorizontalAlignment="Center" VerticalAlignment="Center" />
                                    </DataTemplate>

                                    <ControlTemplate x:Key="PreviousButtonTemplate" TargetType="Button">
                                        <Grid Cursor="Hand">
                                            <vsm:VisualStateManager.VisualStateGroups>
                                                <vsm:VisualStateGroup x:Name="CommonStates">
                                                    <vsm:VisualState x:Name="Normal" />
                                                    <vsm:VisualState x:Name="MouseOver">
                                                        
                                                    </vsm:VisualState>
                                                    <vsm:VisualState x:Name="Disabled">
                                                        
                                                    </vsm:VisualState>
                                                </vsm:VisualStateGroup>
                                            </vsm:VisualStateManager.VisualStateGroups>

                                            <Grid Background="Transparent">
                                                <Path x:Name="IconPath" Fill="{StaticResource Brush1}"
                                                      Height="10" Width="6" Margin="2"
                                                      VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="Fill" 
                                                      Data="M288.75,232.25 L288.75,240.625 L283,236.625 z" />
                                            </Grid>
                                        </Grid>
                                    </ControlTemplate>

                                    <ControlTemplate x:Key="NextButtonTemplate" TargetType="Button">
                                        <Grid Cursor="Hand">
                                            <vsm:VisualStateManager.VisualStateGroups>
                                                <vsm:VisualStateGroup x:Name="CommonStates">
                                                    <vsm:VisualState x:Name="Normal" />
                                                    <vsm:VisualState x:Name="MouseOver">
                                                        
                                                    </vsm:VisualState>
                                                    <vsm:VisualState x:Name="Disabled">
                                                        
                                                    </vsm:VisualState>
                                                </vsm:VisualStateGroup>
                                            </vsm:VisualStateManager.VisualStateGroups>

                                            <Grid Background="Transparent">
                                                <Path x:Name="IconPath" Fill="{StaticResource Brush1}" Margin="2" 
                                                      Height="10" Width="6" 
                                                      Stretch="Fill" VerticalAlignment="Center" HorizontalAlignment="Center" 
                                                      Data="M282.875,231.875 L282.875,240.375 L288.625,236 z" />
                                            </Grid>
                                        </Grid>
                                    </ControlTemplate>
                                </Grid.Resources>

                                <Button x:Name="PreviousButton" Height="20" Width="28" Visibility="Collapsed" 
                                        VerticalAlignment="Center"
                                        Template="{StaticResource PreviousButtonTemplate}" HorizontalAlignment="Left" />

                                <Button x:Name="HeaderButton" Grid.Column="1" FontWeight="Bold" FontSize="12" 
                                        Template="{StaticResource HeaderButtonTemplate}" HorizontalAlignment="Center" 
                                        VerticalAlignment="Center"/>

                                <Button x:Name="NextButton" Grid.Column="2" Height="20" Width="28" Visibility="Collapsed"
                                        Template="{StaticResource NextButtonTemplate}" HorizontalAlignment="Right" 
                                        VerticalAlignment="Center"/>

                                <Grid x:Name="MonthView" Grid.Row="1" Grid.ColumnSpan="3" Visibility="Collapsed" Margin="5 0 5 5">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="24" />
                                        <RowDefinition Height="24" />
                                        <RowDefinition Height="24" />
                                        <RowDefinition Height="24" />
                                        <RowDefinition Height="24" />
                                        <RowDefinition Height="24" />
                                        <RowDefinition Height="24" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="24" />
                                        <ColumnDefinition Width="24" />
                                        <ColumnDefinition Width="24" />
                                        <ColumnDefinition Width="24" />
                                        <ColumnDefinition Width="24" />
                                        <ColumnDefinition Width="24" />
                                        <ColumnDefinition Width="24" />
                                    </Grid.ColumnDefinitions>
                                </Grid>

                                <Grid x:Name="YearView" Grid.Row="1" Grid.ColumnSpan="3" Visibility="Collapsed" Margin="5 0 5 5">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="56" />
                                        <RowDefinition Height="56" />
                                        <RowDefinition Height="56" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="42" />
                                        <ColumnDefinition Width="42" />
                                        <ColumnDefinition Width="42" />
                                        <ColumnDefinition Width="42" />
                                    </Grid.ColumnDefinitions>
                                </Grid>
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controlsPrimitives:CalendarDayButton">
        <Setter Property="Background" Value="{StaticResource Brush3}" />
        <Setter Property="Foreground" Value="{StaticResource Brush2}" />
        <Setter Property="FontSize" Value="10" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controlsPrimitives:CalendarDayButton">
                    <Grid x:Name="root">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" 
                                                         To=".5" Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" 
                                                         To=".5" Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="root" Storyboard.TargetProperty="Opacity" 
                                                         To="{StaticResource OpacityDisable}" Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="SelectionStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="0" />
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Unselected" />
                                <vsm:VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="SelectedBackground" Storyboard.TargetProperty="Opacity" 
                                                         To="1" Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="CalendarButtonFocusStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="0" />
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="CalendarButtonFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" 
                                                                       Storyboard.TargetProperty="Visibility" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="CalendarButtonUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" 
                                                                       Storyboard.TargetProperty="Visibility" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="ActiveStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="0" />
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Active" />
                                <vsm:VisualState x:Name="Inactive">
                                    <Storyboard>
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="root" Storyboard.TargetProperty="Opacity" 
                                                         To="{StaticResource OpacityDisable}" Duration="0" />
                                        </Storyboard>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="DayStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="0" />
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="RegularDay" />
                                <vsm:VisualState x:Name="Today">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="TodayBackground" 
                                                         Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="BlackoutDayStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="0" />
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="NormalDay" />
                                <vsm:VisualState x:Name="BlackoutDay">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="BlackoutVisual" 
                                                         Storyboard.TargetProperty="Opacity" To=".2" Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <Rectangle x:Name="TodayBackground" RadiusX="3" RadiusY="3" Opacity="0" Stroke="{StaticResource Brush3}" 
                                   StrokeThickness="2"/>
                        <Rectangle x:Name="SelectedBackground" RadiusX="3" RadiusY="3" Opacity="0" Fill="{TemplateBinding Background}" />
                        <Rectangle x:Name="Background" RadiusX="3" RadiusY="3" Opacity="0" Fill="{TemplateBinding Background}" />

                        <ContentControl x:Name="Content" IsTabStop="False" Content="{TemplateBinding Content}" 
                                        ContentTemplate="{TemplateBinding ContentTemplate}" 
                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                        FontSize="{TemplateBinding FontSize}"
                                        Foreground="{TemplateBinding Foreground}"/>

                        <Path x:Name="BlackoutVisual" Opacity="0" Margin="3" HorizontalAlignment="Stretch"
                              VerticalAlignment="Stretch" RenderTransformOrigin="0.5,0.5" Fill="{StaticResource Brush1}" 
                              Stretch="Fill" Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633,11.029181 L15.191895,11.029181 L12.844727,13.999395 L15.21875,17.060919 L12.962891,17.060919 L11.673828,15.256231 L10.352539,17.060919 L8.1396484,17.060919 L10.519043,14.042364 z" />
                        <Rectangle x:Name="FocusVisual" Visibility="Collapsed" IsHitTestVisible="false" 
                                   RadiusX="3" RadiusY="3" Stroke="{StaticResource Brush15}" StrokeThickness="2"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controlsPrimitives:CalendarButton">
        <Setter Property="Background" Value="{StaticResource Brush3}" />
        <Setter Property="Foreground" Value="{StaticResource Brush2}" />
        <Setter Property="FontSize" Value="10" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controlsPrimitives:CalendarButton">
                    <Grid x:Name="root">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" 
                                                         To=".5" Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" 
                                                         To=".5" Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="SelectionStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="0" />
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Unselected" />
                                <vsm:VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="SelectedBackground"
                                                         Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="ActiveStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="0" />
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Active" />
                                <vsm:VisualState x:Name="Inactive">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="root" 
                                                        Storyboard.TargetProperty="Opacity" To="{StaticResource OpacityDisable}" 
                                                         Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="CalendarButtonFocusStates">
                                <vsm:VisualState x:Name="CalendarButtonFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" 
                                                                       Storyboard.TargetProperty="Visibility" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="CalendarButtonUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual"
                                                                       Storyboard.TargetProperty="Visibility" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <Rectangle x:Name="SelectedBackground" RadiusX="3" RadiusY="3" Opacity="0" Fill="{TemplateBinding Background}" />
                        <Rectangle x:Name="Background" RadiusX="3" RadiusY="3" Opacity="0" Fill="{TemplateBinding Background}" />

                        <ContentControl x:Name="Content" IsTabStop="False" Foreground="{TemplateBinding Foreground}" 
                                        Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" 
                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                        FontSize="{TemplateBinding FontSize}" />

                        <Rectangle x:Name="FocusVisual" Visibility="Collapsed" IsHitTestVisible="false" 
                                   RadiusX="3" RadiusY="3" Stroke="{StaticResource Brush15}" StrokeThickness="2"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--datepicker-->
    <Style TargetType="controlsPrimitives:DatePickerTextBox" BasedOn="{StaticResource TextBoxBase}"/>
    
    <Style TargetType="controls:DatePicker">
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="FontFamily" Value="{StaticResource FontFamily1}"/>
        <Setter Property="FontSize" Value="{StaticResource FontSize1}"/>
        <Setter Property="SelectionBackground" Value="{StaticResource Brush2}"/>
        <Setter Property="BorderThickness" Value="2"/>
        <Setter Property="Background" Value="{StaticResource Brush5}"/>
        <Setter Property="Foreground" Value="{StaticResource Brush2}"/>
        <Setter Property="Padding" Value="4"/>
        <Setter Property="BorderBrush" Value="{StaticResource Brush4}"/>
        <Setter Property="Height" Value="{StaticResource Height1}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:DatePicker">
                    <Grid x:Name="Root">
                        <Grid.Resources>
                            <ControlTemplate x:Key="DropDownButtonTemplate" TargetType="Button">
                                <Grid FlowDirection="LeftToRight">
                                    <vsm:VisualStateManager.VisualStateGroups>
                                        <vsm:VisualStateGroup x:Name="CommonStates">
                                            <vsm:VisualStateGroup.Transitions>
                                                <vsm:VisualTransition GeneratedDuration="0" />
                                                <vsm:VisualTransition To="MouseOver" GeneratedDuration="0:0:0.1" />
                                                <vsm:VisualTransition To="Pressed" GeneratedDuration="0:0:0.1" />
                                            </vsm:VisualStateGroup.Transitions>
                                            <vsm:VisualState x:Name="Normal" />
                                            <vsm:VisualState x:Name="MouseOver">
                                                <Storyboard>
                                                    <ColorAnimation Duration="0" Storyboard.TargetName="Background" 
                                                                    Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="#FF448DCA" />
                                                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" 
                                                                                  Storyboard.TargetName="BackgroundGradient" 
                                                                                  Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                                                        <SplineColorKeyFrame KeyTime="0" Value="#7FFFFFFF" />
                                                    </ColorAnimationUsingKeyFrames>
                                                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" 
                                                                                  Storyboard.TargetName="BackgroundGradient" 
                                                                                  Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                                                        <SplineColorKeyFrame KeyTime="0" Value="#CCFFFFFF" />
                                                    </ColorAnimationUsingKeyFrames>
                                                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" 
                                                                                  Storyboard.TargetName="BackgroundGradient" 
                                                                                  Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                                        <SplineColorKeyFrame KeyTime="0" Value="#F2FFFFFF" />
                                                    </ColorAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </vsm:VisualState>
                                            <vsm:VisualState x:Name="Pressed">
                                                <Storyboard>
                                                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" 
                                                                                  Storyboard.TargetName="Background" 
                                                                                  Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
                                                        <SplineColorKeyFrame KeyTime="0" Value="#FF448DCA" />
                                                    </ColorAnimationUsingKeyFrames>
                                                    <DoubleAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" 
                                                                                   Storyboard.TargetName="Highlight" 
                                                                                   Storyboard.TargetProperty="(UIElement.Opacity)">
                                                        <SplineDoubleKeyFrame KeyTime="0" Value="1" />
                                                    </DoubleAnimationUsingKeyFrames>
                                                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" 
                                                                                  Storyboard.TargetName="BackgroundGradient" 
                                                                                  Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                                        <SplineColorKeyFrame KeyTime="0" Value="#EAFFFFFF" />
                                                    </ColorAnimationUsingKeyFrames>
                                                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" 
                                                                                  Storyboard.TargetName="BackgroundGradient" 
                                                                                  Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                                                        <SplineColorKeyFrame KeyTime="0" Value="#C6FFFFFF" />
                                                    </ColorAnimationUsingKeyFrames>
                                                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" 
                                                                                  Storyboard.TargetName="BackgroundGradient" 
                                                                                  Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                                                        <SplineColorKeyFrame KeyTime="0" Value="#6BFFFFFF" />
                                                    </ColorAnimationUsingKeyFrames>
                                                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" 
                                                                                  Storyboard.TargetName="BackgroundGradient" 
                                                                                  Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                                                        <SplineColorKeyFrame KeyTime="0" Value="#F4FFFFFF" />
                                                    </ColorAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </vsm:VisualState>
                                            <vsm:VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" 
                                                                                   Storyboard.TargetName="DisabledVisual" 
                                                                                   Storyboard.TargetProperty="(UIElement.Opacity)">
                                                        <SplineDoubleKeyFrame KeyTime="0" Value="1" />
                                                    </DoubleAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </vsm:VisualState>
                                        </vsm:VisualStateGroup>
                                    </vsm:VisualStateManager.VisualStateGroups>

                                    <!--Start UI-->
                                    <Grid Height="18" Width="19" HorizontalAlignment="Center" 
                                          VerticalAlignment="Center" Margin="0" Background="#11FFFFFF">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="20*" />
                                            <ColumnDefinition Width="20*" />
                                            <ColumnDefinition Width="20*" />
                                            <ColumnDefinition Width="20*" />
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="23*" />
                                            <RowDefinition Height="19*" />
                                            <RowDefinition Height="19*" />
                                            <RowDefinition Height="19*" />
                                        </Grid.RowDefinitions>
                                        <Border Margin="-1" Grid.ColumnSpan="4" Grid.Row="0" Grid.RowSpan="4" BorderThickness="1" BorderBrush="#FF6DBDD1" Opacity="0" CornerRadius="0,0,1,1" x:Name="Highlight" />
                                        <Border x:Name="Background" Margin="0,-1,0,0" Grid.ColumnSpan="4" Grid.Row="1" Grid.RowSpan="3" BorderThickness="1" BorderBrush="#FFFFFFFF" Opacity="1" CornerRadius=".5" Background="#FF1F3B53" />
                                        <Border x:Name="BackgroundGradient" Margin="0,-1,0,0" Grid.ColumnSpan="4" Grid.Row="1" Grid.RowSpan="3" BorderThickness="1" BorderBrush="#BF000000" Opacity="1" CornerRadius=".5">
                                            <Border.Background>
                                                <LinearGradientBrush StartPoint=".7,0" EndPoint=".7,1">
                                                    <GradientStop Color="#FFFFFFFF" Offset="0" />
                                                    <GradientStop Color="#F9FFFFFF" Offset="0.375" />
                                                    <GradientStop Color="#E5FFFFFF" Offset="0.625" />
                                                    <GradientStop Color="#C6FFFFFF" Offset="1" />
                                                </LinearGradientBrush>
                                            </Border.Background>
                                        </Border>
                                        <Rectangle Grid.ColumnSpan="4" Grid.RowSpan="1" StrokeThickness="1">
                                            <Rectangle.Stroke>
                                                <LinearGradientBrush EndPoint="0.48,-1" StartPoint="0.48,1.25">
                                                    <GradientStop Color="#FF494949" />
                                                    <GradientStop Color="#FF9F9F9F" Offset="1" />
                                                </LinearGradientBrush>
                                            </Rectangle.Stroke>
                                            <Rectangle.Fill>
                                                <LinearGradientBrush EndPoint="0.3,-1.1" StartPoint="0.46,1.6">
                                                    <GradientStop Color="#FF4084BD" />
                                                    <GradientStop Color="#FFAFCFEA" Offset="1" />
                                                </LinearGradientBrush>
                                            </Rectangle.Fill>
                                        </Rectangle>
                                        <Path HorizontalAlignment="Center" Margin="4,3,4,3" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" Grid.Column="0" Grid.Row="1" Fill="#FF2F2F2F" Stretch="Fill" Data="M11.426758,8.4305077 L11.749023,8.4305077 L11.749023,16.331387 L10.674805,16.331387 L10.674805,10.299648 L9.0742188,11.298672 L9.0742188,10.294277 C9.4788408,10.090176 9.9094238,9.8090878 10.365967,9.4510155 C10.82251,9.0929432 11.176106,8.7527733 11.426758,8.4305077 z M14.65086,8.4305077 L18.566387,8.4305077 L18.566387,9.3435936 L15.671368,9.3435936 L15.671368,11.255703 C15.936341,11.058764 16.27293,10.960293 16.681133,10.960293 C17.411602,10.960293 17.969301,11.178717 18.354229,11.615566 C18.739157,12.052416 18.931622,12.673672 18.931622,13.479336 C18.931622,15.452317 18.052553,16.438808 16.294415,16.438808 C15.560365,16.438808 14.951641,16.234707 14.468243,15.826504 L14.881817,14.929531 C15.368796,15.326992 15.837872,15.525723 16.289043,15.525723 C17.298809,15.525723 17.803692,14.895514 17.803692,13.635098 C17.803692,12.460618 17.305971,11.873379 16.310528,11.873379 C15.83071,11.873379 15.399232,12.079271 15.016094,12.491055 L14.65086,12.238613 z" Grid.ColumnSpan="4" Grid.RowSpan="3" />
                                        <Ellipse HorizontalAlignment="Center" VerticalAlignment="Center" Fill="#FFFFFFFF" StrokeThickness="0" Grid.ColumnSpan="4" Width="3" Height="3" />
                                        <Border Grid.ColumnSpan="4" Grid.Row="0" Grid.RowSpan="4" BorderThickness="1" BorderBrush="#B2FFFFFF" Opacity="0" CornerRadius="0,0,.5,.5" x:Name="DisabledVisual" />
                                    </Grid>
                                    <!--End UI-->
                                </Grid>
                            </ControlTemplate>
                        </Grid.Resources>
                        
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="Disabled">
                                    
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="ValidationStates">
                                <vsm:VisualState x:Name="Valid" />
                                <vsm:VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement"
                                                                       Storyboard.TargetProperty="BorderBrush">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource Brush8}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement"
                                                                       Storyboard.TargetProperty="BorderBrush">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource Brush8}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <controlsPrimitives:DatePickerTextBox x:Name="TextBox"
                                                              SelectionBackground="{TemplateBinding SelectionBackground}" 
                                                              SelectionForeground="{StaticResource Brush5}"
                                                              Background="{TemplateBinding Background}"
                                                              BorderBrush="{TemplateBinding BorderBrush}" 
                                                              CaretBrush="{StaticResource CaretColor}"
                                                              BorderThickness="{TemplateBinding BorderThickness}" 
                                                              Padding="{TemplateBinding Padding}" Grid.Column="0" />
                        
                        
                        
                        <Button x:Name="Button" Template="{StaticResource DropDownButtonTemplate}" 
                                Grid.Column="1" Width="20" Foreground="{TemplateBinding Foreground}" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}" 
                                Margin="2,0,2,0" />

                        <Border x:Name="ValidationErrorElement" Visibility="Collapsed" BorderBrush="{StaticResource Brush8}" 
                                BorderThickness="2" CornerRadius="4">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" 
                                         Template="{StaticResource ValidationToolTipTemplate}" Placement="Right" 
                                         PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="true"/>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Height="12" HorizontalAlignment="Right" Margin="1,-4,-4,0" VerticalAlignment="Top" Width="12" Background="Transparent">
                                <Path Fill="#FFDC000C" Margin="1,3,0,0" Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z" />
                                <Path Fill="#ffffff" Margin="1,3,0,0" Data="M 0,0 L2,0 L 8,6 L8,8" />
                            </Grid>
                        </Border>

                        <Popup x:Name="Popup"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--childwindow-->
    <Style TargetType="controls:ChildWindow">
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="TabNavigation" Value="Cycle" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="BorderBrush" Value="{StaticResource Brush4}"/>
        <Setter Property="OverlayBrush" Value="{StaticResource Brush18}"/>
        <Setter Property="OverlayOpacity" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:ChildWindow">
                    <Grid x:Name="Root">
                        <Grid.Resources>
                            <Style x:Key="ButtonStyle" TargetType="Button">
                                <Setter Property="Background" Value="#FF1F3B53" />
                                <Setter Property="Foreground" Value="#FF000000" />
                                <Setter Property="Padding" Value="3" />
                                <Setter Property="BorderThickness" Value="1" />
                                <Setter Property="BorderBrush">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFA3AEB9" Offset="0" />
                                            <GradientStop Color="#FF8399A9" Offset="0.375" />
                                            <GradientStop Color="#FF718597" Offset="0.375" />
                                            <GradientStop Color="#FF617584" Offset="1" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="Button">
                                            <Grid HorizontalAlignment="Center" VerticalAlignment="Center" Width="15" Height="14" Background="#02FFFFFF" x:Name="grid">
                                                <vsm:VisualStateManager.VisualStateGroups>
                                                    <vsm:VisualStateGroup x:Name="CommonStates">
                                                        <vsm:VisualState x:Name="Normal" />
                                                        <vsm:VisualState x:Name="MouseOver">
                                                            <Storyboard>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="X_Fuzz2" Storyboard.TargetProperty="Visibility">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                                                </ObjectAnimationUsingKeyFrames>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="X_Fuzz1" Storyboard.TargetProperty="Visibility">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                                                </ObjectAnimationUsingKeyFrames>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="X_Fuzz0" Storyboard.TargetProperty="Visibility">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                                                </ObjectAnimationUsingKeyFrames>
                                                                <DoubleAnimation Duration="0" Storyboard.TargetName="X" Storyboard.TargetProperty="Opacity" To="0.95" />
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Pressed">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0" Storyboard.TargetName="X" Storyboard.TargetProperty="Opacity" To="0.85" />
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="X_Fuzz2" Storyboard.TargetProperty="Visibility">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                                                </ObjectAnimationUsingKeyFrames>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="X_Fuzz1" Storyboard.TargetProperty="Visibility">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                                                </ObjectAnimationUsingKeyFrames>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="X_Fuzz0" Storyboard.TargetProperty="Visibility">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                                                </ObjectAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Disabled">
                                                            <Storyboard>
                                                                <DoubleAnimation Duration="0" Storyboard.TargetName="X" Storyboard.TargetProperty="Opacity" To="0.5" />
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                    </vsm:VisualStateGroup>
                                                </vsm:VisualStateManager.VisualStateGroups>
                                                <Path HorizontalAlignment="Center" Margin="0,-1,0,0" Width="9" Fill="#14C51900" Stretch="Fill" Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" x:Name="X_Fuzz2" Stroke="#14C51900" Height="8" VerticalAlignment="Center" Opacity="1" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed">
                                                    <Path.RenderTransform>
                                                        <TransformGroup>
                                                            <ScaleTransform ScaleX="1.3" ScaleY="1.3" />
                                                        </TransformGroup>
                                                    </Path.RenderTransform>
                                                </Path>
                                                <Path HorizontalAlignment="Center" Margin="0,-1,0,0" Width="9" Fill="#1EC51900" Stretch="Fill" Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" x:Name="X_Fuzz1" Stroke="#1EC51900" Height="8" VerticalAlignment="Center" Opacity="1" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed">
                                                    <Path.RenderTransform>
                                                        <TransformGroup>
                                                            <ScaleTransform ScaleX="1.1" ScaleY="1.1" />
                                                        </TransformGroup>
                                                    </Path.RenderTransform>
                                                </Path>
                                                <Path HorizontalAlignment="Center" Margin="0,-1,0,0" Width="9" Fill="#FFC51900" Stretch="Fill" Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" x:Name="X_Fuzz0" Stroke="#FFC51900" Height="8" VerticalAlignment="Center" Opacity="1" Visibility="Collapsed" />
                                                <Path HorizontalAlignment="Center" Margin="0,-1,0,0" Width="9" Fill="#FFFFFFFF" Stretch="Fill" Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" x:Name="X" Height="8" VerticalAlignment="Center" Opacity="0.7">
                                                    <Path.Stroke>
                                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                            <GradientStop Color="#FF313131" Offset="1" />
                                                            <GradientStop Color="#FF8E9092" Offset="0" />
                                                        </LinearGradientBrush>
                                                    </Path.Stroke>
                                                </Path>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Grid.Resources>
                        
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="WindowStates">
                                <vsm:VisualState x:Name="Open">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="Overlay" 
                                                                       Storyboard.TargetProperty="Opacity">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0" />
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="ContentRoot" 
                                                                       Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleX">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="0" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.4" Value="1" />
                                            <SplineDoubleKeyFrame KeySpline="0,0,0.5,1" KeyTime="00:00:00.45" Value="1.05" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.55" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="ContentRoot" 
                                                                       Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleY">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="0" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.4" Value="1" />
                                            <SplineDoubleKeyFrame KeySpline="0,0,0.5,1" KeyTime="00:00:00.45" Value="1.05" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.55" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Closed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="Overlay" 
                                                                       Storyboard.TargetProperty="Opacity">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                            <EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="ContentRoot" 
                                                                       Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleX">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="1" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1.05" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.45" Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="ContentRoot" 
                                                                       Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleY">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="1" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1.05" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.45" Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        
                        <Grid x:Name="Overlay" HorizontalAlignment="Stretch" VerticalAlignment="Top" 
                              Margin="0" Background="{TemplateBinding OverlayBrush}" Opacity="{TemplateBinding OverlayOpacity}" />
                        
                        <Grid x:Name="ContentRoot" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                              VerticalAlignment="{TemplateBinding VerticalAlignment}" RenderTransformOrigin="0.5,0.5" 
                              Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
                            <Grid.Effect>
                                <DropShadowEffect BlurRadius="6" Color="Black" Opacity="1" ShadowDepth="0"/>
                            </Grid.Effect>
                            <Grid.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform />
                                    <SkewTransform />
                                    <RotateTransform />
                                    <TranslateTransform />
                                </TransformGroup>
                            </Grid.RenderTransform>
                            
                            <Border Background="{StaticResource Brush5}" BorderThickness="{TemplateBinding BorderThickness}" 
                                    BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="4">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    
                                    <Border x:Name="Chrome" Width="Auto" BorderThickness="0 0 0 2" Background="{StaticResource Brush12}"
                                            MinHeight="20" CornerRadius="3 3 0 0" BorderBrush="{StaticResource Brush1}">
                                        <Grid Height="Auto" Width="Auto">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition />
                                                <ColumnDefinition Width="30" />
                                            </Grid.ColumnDefinitions>
                                            
                                            <ContentControl Content="{TemplateBinding Title}" IsTabStop="False" FontWeight="Bold" 
                                                            HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="6,0,6,0"
                                                            FontFamily="{StaticResource FontFamily1}"
                                                            FontSize="{StaticResource FontSize1}"
                                                            Foreground="{StaticResource Brush2}"/>
                                            <Button x:Name="CloseButton" Grid.Column="1" IsTabStop="False" HorizontalAlignment="Center"
                                                    VerticalAlignment="Center" Width="15" Height="14" 
                                                    Style="{StaticResource ButtonStyle}" />
                                        </Grid>
                                    </Border>
                                    <Border Background="{TemplateBinding Background}" Margin="7" Grid.Row="1" CornerRadius="0 0 3 3">
                                        <ContentPresenter x:Name="ContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                    </Border>
                                </Grid>
                            </Border>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--treeview-->
    <Style TargetType="controls:TreeView">
        <Setter Property="Background" Value="{StaticResource Brush5}" />
        <Setter Property="Foreground" Value="{StaticResource Brush2}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="Padding" Value="2" />
        <Setter Property="BorderBrush" Value="{StaticResource Brush4}" />
        <Setter Property="IsTabStop" Value="True" />
        <Setter Property="TabNavigation" Value="Once" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:TreeView">
                    <Grid>
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="MouseOver" />
                                <vsm:VisualState x:Name="Pressed" />
                                <vsm:VisualState x:Name="Disabled" >
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Border"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="{StaticResource OpacityDisable}"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="FocusStates">
                                <vsm:VisualState x:Name="Unfocused" />
                                <vsm:VisualState x:Name="Focused" />
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="ValidationStates">
                                <vsm:VisualState x:Name="Valid" />
                                <vsm:VisualState x:Name="InvalidUnfocused">

                                </vsm:VisualState>
                                <vsm:VisualState x:Name="InvalidFocused">

                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <Border x:Name="Border" BorderThickness="2" CornerRadius="4" 
                                Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}"
                                Padding="0">

                            <ScrollViewer x:Name="ScrollViewer" Padding="{TemplateBinding Padding}"
                                          Background="{x:Null}" 
                                          BorderBrush="Transparent" BorderThickness="0" Margin="0"
                                          TabNavigation="{TemplateBinding TabNavigation}" >
                                <ItemsPresenter />
                            </ScrollViewer>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:TreeViewItem">
        <Setter Property="Padding" Value="0" />
        <Setter Property="Foreground" Value="{StaticResource Brush2}"/>
        <Setter Property="FontFamily" Value="{StaticResource FontFamily1}"/>
        <Setter Property="FontSize" Value="{StaticResource FontSize1}"/>
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush" Value="{StaticResource Brush1}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="IsTabStop" Value="True" />
        <Setter Property="TabNavigation" Value="Once" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:TreeViewItem">
                    <Grid Background="Transparent" Margin="{TemplateBinding Padding}">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" >
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="HoverBorder" 
                                                         Storyboard.TargetProperty="Opacity" 
                                                         Duration="0:0:0" To="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="MouseOver" >
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="HoverBorder" 
                                                         Storyboard.TargetProperty="Opacity" 
                                                         Duration="0:0:0" To="0.5" />
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Pressed" />
                                <vsm:VisualState x:Name="Disabled">

                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="SelectionStates">
                                <vsm:VisualState x:Name="Unselected" />
                                <vsm:VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="SelectBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1" Duration="0:0:0"/>
                                        <DoubleAnimation Storyboard.TargetName="HoverBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0" Duration="0:0:0"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="SelectedInactive">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="SelectBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0.5" Duration="0:0:0"/>
                                        <DoubleAnimation Storyboard.TargetName="HoverBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0" Duration="0:0:0"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="HasItemsStates">
                                <vsm:VisualState x:Name="HasItems" />
                                <vsm:VisualState x:Name="NoItems">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpanderButton" 
                                                                       Storyboard.TargetProperty="Visibility" 
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpanderButton" 
                                                                       Storyboard.TargetProperty="IsHitTestVisible" 
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="False" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>

                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="ExpansionStates">
                                <vsm:VisualState x:Name="Collapsed" >
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" 
                                                                       Storyboard.TargetProperty="Visibility" 
                                                                       BeginTime="0:0:0.2">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.0" Value="Collapsed" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="line" 
                                                                       Storyboard.TargetProperty="Visibility" 
                                                                       Duration="0:0:0.2">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.2" Value="Collapsed" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Storyboard.TargetName="line"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.0" To="0"/>
                                        <DoubleAnimation Storyboard.TargetName="ExpandSite"
                                                         Storyboard.TargetProperty="Opacity"
                                                         BeginTime="0:0:0"
                                                         Duration="0:0:0.0" To="0"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" 
                                                                       Storyboard.TargetProperty="Visibility" 
                                                                       BeginTime="0:0:0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="line" 
                                                                       Storyboard.TargetProperty="Visibility" 
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Storyboard.TargetName="line"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0:0:0.0" To="1"/>
                                        <DoubleAnimation Storyboard.TargetName="ExpandSite"
                                                         Storyboard.TargetProperty="Opacity"
                                                         BeginTime="0:0:0.00"
                                                         Duration="0:0:0.0" To="1"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="ValidationStates">
                                <vsm:VisualState x:Name="Valid" />
                                <vsm:VisualState x:Name="InvalidUnfocused">

                                </vsm:VisualState>
                                <vsm:VisualState x:Name="InvalidFocused">

                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>


                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>


                        <Grid x:Name="HoverBorder" Opacity="0"
                              IsHitTestVisible="False" Margin="5 0 0 0">
                            <Border BorderBrush="{TemplateBinding BorderBrush}" 
                                    CornerRadius="3"
                                    BorderThickness="0"
                                    Background="{StaticResource Brush3}"/>
                        </Grid>

                        <Grid x:Name="SelectBorder" Opacity="0" Background="Transparent"
                              IsHitTestVisible="False" Margin="5 0 0 0">
                            <Border BorderBrush="{StaticResource Brush15}" 
                                    CornerRadius="3"
                                    BorderThickness="2"
                                    Background="{StaticResource Brush3}"/>
                        </Grid>

                        <Grid >
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"
                                    MinHeight="20">
                                <Line x:Name="lineH" Stroke="{TemplateBinding BorderBrush}" 
                                      StrokeThickness="1" X1="0" X2="10"
                                      Y1="0" Y2="0" StrokeDashArray="1 2" Stretch="UniformToFill"
                                      VerticalAlignment="Center" HorizontalAlignment="Left"                           
                                      UseLayoutRounding="True" IsHitTestVisible="False"/>

                                <ToggleButton x:Name="ExpanderButton" HorizontalAlignment="Left" Width="14"
                                          Height="14" Margin="3 0 0 0"
                                      VerticalAlignment="Center" IsTabStop="False" TabNavigation="Once">
                                    <ToggleButton.Template>
                                        <ControlTemplate TargetType="ToggleButton">
                                            <Grid x:Name="Root" Background="Transparent" >
                                                <vsm:VisualStateManager.VisualStateGroups>
                                                    <vsm:VisualStateGroup x:Name="CommonStates">
                                                        <vsm:VisualState x:Name="Normal" />
                                                        <vsm:VisualState x:Name="MouseOver">
                                                            <Storyboard>
                                                                <DoubleAnimation Storyboard.TargetName="OuterBorder" 
                                                                         Storyboard.TargetProperty="Opacity" 
                                                                         To="1" Duration="0:0:0.0" />
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Disabled">
                                                            <Storyboard>
                                                                <DoubleAnimation Storyboard.TargetName="Root" 
                                                                         Storyboard.TargetProperty="Opacity" 
                                                                         To="{StaticResource OpacityDisable}" 
                                                                         Duration="0" />
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                    </vsm:VisualStateGroup>
                                                    <vsm:VisualStateGroup x:Name="CheckStates">
                                                        <vsm:VisualState x:Name="Unchecked" />
                                                        <vsm:VisualState x:Name="Checked">
                                                            <Storyboard>
                                                                <DoubleAnimation Storyboard.TargetName="UncheckedVisual" 
                                                                         Storyboard.TargetProperty="Opacity" 
                                                                         To="0" Duration="0" />
                                                                <DoubleAnimation Storyboard.TargetName="CheckedVisual" 
                                                                         Storyboard.TargetProperty="Opacity" 
                                                                         To="1" Duration="0" />
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                    </vsm:VisualStateGroup>
                                                </vsm:VisualStateManager.VisualStateGroups>


                                                <Border x:Name="OuterBorder" 
                                                        BorderBrush="{StaticResource Brush10}" 
                                                        CornerRadius="3"
                                                        BorderThickness="1" Opacity="0.5"
                                                        Background="{StaticResource Brush12}"/>

                                                <Grid Margin="3" >
                                                    <Path x:Name="UncheckedVisual" UseLayoutRounding="False"
                                                  HorizontalAlignment="Center"  Stretch="Uniform" 
                                                  Data="M0,4 L4,4 L4,0 L6,0 L6,4 L10,4 L10,6 L6,6 L6,10 L4,10 L4,6 L0,6 z" 
                                                  VerticalAlignment="Center" 
                                                  Opacity="1" Fill="{StaticResource Brush1}">
                                                    </Path>
                                                    <Path x:Name="CheckedVisual" UseLayoutRounding="False"
                                                  HorizontalAlignment="Center" Stretch="Uniform" 
                                                  Data="M0,4 L10,4 L10,6 L0,6 z" 
                                                  VerticalAlignment="Center" 
                                                  Opacity="0" Fill="{StaticResource Brush1}">
                                                    </Path>
                                                </Grid>
                                            </Grid>
                                        </ControlTemplate>
                                    </ToggleButton.Template>
                                </ToggleButton>

                                <Button x:Name="Header" ClickMode="Hover"
                                        Background="{TemplateBinding Background}" 
                                        Foreground="{TemplateBinding Foreground}" 
                                        BorderBrush="{TemplateBinding BorderBrush}" 
                                        BorderThickness="{TemplateBinding BorderThickness}" 
                                        Cursor="{TemplateBinding Cursor}" 
                                        HorizontalAlignment="Stretch" 
                                        VerticalAlignment="Stretch" Margin="3 0"
                                        FontFamily="{TemplateBinding FontFamily}"
                                        FontWeight="{TemplateBinding FontWeight}"
                                        FontSize="{TemplateBinding FontSize}"
                                        IsTabStop="False" TabNavigation="Once">
                                    <Button.Template>
                                        <ControlTemplate TargetType="Button">
                                            <Grid>
                                                <vsm:VisualStateManager.VisualStateGroups>
                                                    <vsm:VisualStateGroup x:Name="CommonStates">
                                                        <vsm:VisualState x:Name="Normal" />
                                                        <vsm:VisualState x:Name="Pressed">

                                                        </vsm:VisualState>
                                                        <vsm:VisualState x:Name="Disabled">
                                                            <Storyboard>
                                                                <DoubleAnimation Storyboard.TargetName="Content" 
                                                                                 Storyboard.TargetProperty="Opacity" 
                                                                                 Duration="0" To="{StaticResource OpacityDisable}" />
                                                            </Storyboard>
                                                        </vsm:VisualState>
                                                    </vsm:VisualStateGroup>
                                                </vsm:VisualStateManager.VisualStateGroups>
                                                <Grid Background="Transparent" >
                                                    <ContentPresenter x:Name="Content" Cursor="{TemplateBinding Cursor}" 
                                                          Content="{TemplateBinding Content}" 
                                                          ContentTemplate="{TemplateBinding ContentTemplate}" 
                                                          HorizontalAlignment="Stretch"
                                                          VerticalAlignment="Center"/>
                                                </Grid>
                                            </Grid>
                                        </ControlTemplate>
                                    </Button.Template>

                                    <Button.Content>
                                        <Grid Background="Transparent" >
                                            <ContentPresenter Content="{TemplateBinding Header}" 
                                                    ContentTemplate="{TemplateBinding HeaderTemplate}" />
                                        </Grid>

                                    </Button.Content>
                                </Button>
                            </StackPanel>
                        </Grid>


                        <ContentControl x:Name="ExpandSite" Grid.Row="1"
                                      Margin="20 0 0 0"
                                      Visibility="Collapsed"
                                      HorizontalAlignment="Stretch"
                                      HorizontalContentAlignment="Stretch">
                            <ItemsPresenter />
                        </ContentControl>

                        <Border Grid.Row="1" Margin="20 0 0 0" IsHitTestVisible="False">
                            <Line x:Name="line" Stroke="{TemplateBinding BorderBrush}" 
                                  StrokeThickness="1" X1="0" X2="0"
                              Y1="0" Y2="4" StrokeDashArray="1 2"
                                  Stretch="UniformToFill"
                              Width="1"  VerticalAlignment="Stretch" HorizontalAlignment="Left"                              
                              UseLayoutRounding="False" Opacity="0" Visibility="Collapsed"/>
                        </Border>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--tabcontrol-->
    <Style TargetType="controls:TabControl">
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Background" Value="{StaticResource Brush5}"/>
        <Setter Property="BorderBrush" Value="{StaticResource Brush4}"/>
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="Padding" Value="5" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:TabControl">
                    <Grid x:Name="root">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="root"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="{StaticResource OpacityDisable}"
                                                         Duration="0"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <!-- TabStripPlacement Top -->
                        <Grid x:Name="TemplateTop" Visibility="Collapsed">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>

                            <Border Background="{StaticResource Brush12}" Canvas.ZIndex="1" CornerRadius="10 10 0 0"
                                    BorderThickness="2 2 2 0" BorderBrush="{TemplateBinding BorderBrush}">
                                <controlsPrimitives:TabPanel x:Name="TabPanelTop" Margin="3 -2 3 -2"/>
                            </Border>
                            

                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
                                    Background="{TemplateBinding Background}" Grid.Row="1" MinHeight="10" MinWidth="10" 
                                    CornerRadius="0 0 3 3">

                                <ContentPresenter x:Name="ContentTop" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                                                  VerticalAlignment="{TemplateBinding VerticalAlignment}" 
                                                  Margin="{TemplateBinding Padding}" Cursor="{TemplateBinding Cursor}" />
                            </Border>
                        </Grid>

                        <!-- TabStripPlacement Bottom -->
                        <Grid x:Name="TemplateBottom" Visibility="Collapsed">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <Border Background="{StaticResource Brush12}" Canvas.ZIndex="1" CornerRadius="0 0 3 3"
                                    BorderThickness="2 0 2 2" BorderBrush="{TemplateBinding BorderBrush}" Grid.Row="1">
                                <controlsPrimitives:TabPanel x:Name="TabPanelBottom" Margin="3 -2 3 -2"/>
                            </Border>


                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
                                    Background="{TemplateBinding Background}" MinHeight="10" MinWidth="10" 
                                    CornerRadius="3 3 0 0">

                                <ContentPresenter x:Name="ContentBottom" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                                                  VerticalAlignment="{TemplateBinding VerticalAlignment}" 
                                                  Margin="{TemplateBinding Padding}" Cursor="{TemplateBinding Cursor}" />
                            </Border>
                        </Grid>

                        <!-- TabStripPlacement Left -->
                        <Grid x:Name="TemplateLeft" Visibility="Collapsed">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <Border Background="{StaticResource Brush12}" Canvas.ZIndex="1" CornerRadius="3 0 0 3"
                                    BorderThickness="2 2 0 2" BorderBrush="{TemplateBinding BorderBrush}">
                                <controlsPrimitives:TabPanel x:Name="TabPanelLeft" Margin="-2 3 -2 3"/>
                            </Border>


                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
                                    Background="{TemplateBinding Background}" Grid.Column="1" MinHeight="10" MinWidth="10" 
                                    CornerRadius="0 3 3 0">

                                <ContentPresenter x:Name="ContentLeft" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                                                  VerticalAlignment="{TemplateBinding VerticalAlignment}" 
                                                  Margin="{TemplateBinding Padding}" Cursor="{TemplateBinding Cursor}" />
                            </Border>
                        </Grid>

                        <!-- TabStripPlacement Right -->
                        <Grid x:Name="TemplateRight" Visibility="Collapsed">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <Border Background="{StaticResource Brush12}" Canvas.ZIndex="1" CornerRadius="0 3 3 0"
                                    BorderThickness="0 2 2 2" BorderBrush="{TemplateBinding BorderBrush}" Grid.Column="1">
                                <controlsPrimitives:TabPanel x:Name="TabPanelRight" Margin="-2 3 -2 3"/>
                            </Border>


                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
                                    Background="{TemplateBinding Background}" MinHeight="10" MinWidth="10" 
                                    CornerRadius="3 0 0 3">

                                <ContentPresenter x:Name="ContentRight" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                                                  VerticalAlignment="{TemplateBinding VerticalAlignment}" 
                                                  Margin="{TemplateBinding Padding}" Cursor="{TemplateBinding Cursor}" />
                            </Border>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:TabItem">
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="FontFamily" Value="{StaticResource FontFamily1}"/>
        <Setter Property="FontSize" Value="{StaticResource FontSize1}"/>
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="{StaticResource Brush4}" />
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="Padding" Value="5 5" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="MinHeight" Value="{StaticResource Height1}" />
        <Setter Property="MinWidth" Value="5" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:TabItem">
                    <Grid x:Name="Root">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Root"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="{StaticResource OpacityDisable}"
                                                         Duration="0"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="SelectionStates">
                                <vsm:VisualState x:Name="Unselected" />
                                <vsm:VisualState x:Name="Selected" />
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="FocusStates">
                                <vsm:VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusTop"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame Value="Visible" KeyTime="0"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusBottom"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame Value="Visible" KeyTime="0"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusLeft"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame Value="Visible" KeyTime="0"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusRight"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame Value="Visible" KeyTime="0"/>
                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusTopUnselected"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame Value="Visible" KeyTime="0"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusBottomUnselected"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame Value="Visible" KeyTime="0"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusLeftUnselected"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame Value="Visible" KeyTime="0"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusRightUnselected"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame Value="Visible" KeyTime="0"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Unfocused">
                                    
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <!-- TabStripPlacement Top | Selected -->
                        <Grid x:Name="TemplateTopSelected" Visibility="Collapsed" Canvas.ZIndex="1">
                            <Border BorderBrush="Transparent" BorderThickness="2 2 2 0" 
                                    Background="{TemplateBinding Background}" Margin="0">
                                <ContentControl x:Name="HeaderTopSelected" IsTabStop="False" 
                                                Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"
                                                FontFamily="{TemplateBinding FontFamily}"
                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                                Margin="{TemplateBinding Padding}" Cursor="{TemplateBinding Cursor}" />
                            </Border>

                            <!--Focus Visual-->
                            <Border x:Name="FocusTop" BorderThickness="2 2 2 0" CornerRadius="0"
                                BorderBrush="{StaticResource Brush15}" Margin="2 2 2 0" Visibility="Collapsed"/>
                        </Grid>

                        <!-- TabStripPlacement Top | Unselected -->
                        <Grid x:Name="TemplateTopUnselected" Visibility="Collapsed">
                            <Border BorderThickness="2 2 2 0" Background="{TemplateBinding Background}" Margin="0" 
                                    BorderBrush="Transparent">
                                <ContentControl x:Name="HeaderTopUnselected" IsTabStop="False" 
                                                Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"
                                                FontFamily="{TemplateBinding FontFamily}"
                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                                Margin="{TemplateBinding Padding}" Cursor="{TemplateBinding Cursor}" />
                            </Border>

                            <!--Focus Visual-->
                            <Border x:Name="FocusTopUnselected" BorderThickness="2 2 2 0" CornerRadius="0"
                                BorderBrush="{StaticResource Brush15}" Margin="2 2 2 0" Visibility="Collapsed"/>
                        </Grid>

                        <!-- TabStripPlacement Bottom | Selected -->
                        <Grid x:Name="TemplateBottomSelected" Visibility="Collapsed" Canvas.ZIndex="1">
                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="2 0 2 2" 
                                    Background="{StaticResource Brush5}" Margin="0">
                                <ContentControl x:Name="HeaderBottomSelected" IsTabStop="False" 
                                                Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"
                                                FontFamily="{TemplateBinding FontFamily}"
                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                                Margin="{TemplateBinding Padding}" Cursor="{TemplateBinding Cursor}" />
                            </Border>

                            <!--Focus Visual-->
                            <Border x:Name="FocusBottom" BorderThickness="2 0 2 2" CornerRadius="0"
                                BorderBrush="{StaticResource Brush15}" Margin="2 0 2 2" Visibility="Collapsed"/>
                        </Grid>

                        <!-- TabStripPlacement Bottom + Unselected -->
                        <Grid x:Name="TemplateBottomUnselected" Visibility="Collapsed">
                            <Border BorderThickness="2 0 2 2" Background="{TemplateBinding Background}" Margin="0" 
                                    BorderBrush="Transparent">
                                <ContentControl x:Name="HeaderBottomUnselected" IsTabStop="False" 
                                                Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"
                                                FontFamily="{TemplateBinding FontFamily}"
                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                                Margin="{TemplateBinding Padding}" Cursor="{TemplateBinding Cursor}" />
                            </Border>

                            <!--Focus Visual-->
                            <Border x:Name="FocusBottomUnselected" BorderThickness="2 0 2 2" CornerRadius="0"
                                BorderBrush="{StaticResource Brush15}" Margin="2 0 2 2" Visibility="Collapsed"/>
                        </Grid>

                        <!-- TabStripPlacement Left | Selected -->
                        <Grid x:Name="TemplateLeftSelected" Visibility="Collapsed" Canvas.ZIndex="1">
                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="2 2 0 2" 
                                    Background="{StaticResource Brush5}" Margin="0">
                                <ContentControl x:Name="HeaderLeftSelected" IsTabStop="False" 
                                                Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"
                                                FontFamily="{TemplateBinding FontFamily}"
                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                                Margin="{TemplateBinding Padding}" Cursor="{TemplateBinding Cursor}" />
                            </Border>

                            <!--Focus Visual-->
                            <Border x:Name="FocusLeft" BorderThickness="2 2 0 2" CornerRadius="0"
                                BorderBrush="{StaticResource Brush15}" Margin="2 2 0 2" Visibility="Collapsed"/>
                        </Grid>

                        <!-- TabStripPlacement Left | Unselected -->
                        <Grid x:Name="TemplateLeftUnselected" Visibility="Collapsed">
                            <Border BorderThickness="2 2 0 2" Background="{TemplateBinding Background}" Margin="0" 
                                    BorderBrush="Transparent">
                                <ContentControl x:Name="HeaderLeftUnselected" IsTabStop="False" 
                                                Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"
                                                FontFamily="{TemplateBinding FontFamily}"
                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                                Margin="{TemplateBinding Padding}" Cursor="{TemplateBinding Cursor}" />
                            </Border>

                            <!--Focus Visual-->
                            <Border x:Name="FocusLeftUnselected" BorderThickness="2 2 0 2" CornerRadius="0"
                                BorderBrush="{StaticResource Brush15}" Margin="2 2 0 2" Visibility="Collapsed"/>
                        </Grid>

                        <!-- TabStripPlacement Right | Selected -->
                        <Grid x:Name="TemplateRightSelected" Visibility="Collapsed" Canvas.ZIndex="1">
                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0 2 2 2" 
                                    Background="{StaticResource Brush5}" Margin="0">
                                <ContentControl x:Name="HeaderRightSelected" IsTabStop="False" 
                                                Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"
                                                FontFamily="{TemplateBinding FontFamily}"
                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                                Margin="{TemplateBinding Padding}" Cursor="{TemplateBinding Cursor}" />
                            </Border>

                            <!--Focus Visual-->
                            <Border x:Name="FocusRight" BorderThickness="0 2 2 2" CornerRadius="0"
                                BorderBrush="{StaticResource Brush15}" Margin="0 2 2 2" Visibility="Collapsed"/>
                        </Grid>

                        <!-- TabStripPlacement Right + Unselected -->
                        <Grid x:Name="TemplateRightUnselected" Visibility="Collapsed">
                            <Border BorderThickness="0 2 2 2" Background="{TemplateBinding Background}" Margin="0" 
                                    BorderBrush="Transparent">
                                <ContentControl x:Name="HeaderRightUnselected" IsTabStop="False" 
                                                Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"
                                                FontFamily="{TemplateBinding FontFamily}"
                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                                Margin="{TemplateBinding Padding}" Cursor="{TemplateBinding Cursor}" />
                            </Border>

                            <!--Focus Visual-->
                            <Border x:Name="FocusRightUnselected" BorderThickness="0 2 2 2" CornerRadius="0"
                                BorderBrush="{StaticResource Brush15}" Margin="0 2 2 2" Visibility="Collapsed"/>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--gridsplitter-->
    <Style TargetType="controls:GridSplitter">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="IsTabStop" Value="true" />
        <Setter Property="HorizontalAlignment" Value="Right" />
        <Setter Property="PreviewStyle">
            <Setter.Value>
                <Style TargetType="Control">
                    <Setter Property="Background" Value="{StaticResource Brush1}" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="Control">
                                <Grid x:Name="Root" Opacity=".5">

                                    <Rectangle Fill="{TemplateBinding Background}" />

                                    <Grid x:Name="HorizontalTemplate" Height="6">
                                    </Grid>

                                    <Grid x:Name="VerticalTemplate" Visibility="Collapsed" Width="6"/>

                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:GridSplitter">
                    <Grid x:Name="Root" IsHitTestVisible="{TemplateBinding IsEnabled}">

                        <!-- VSM -->
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="MouseOver" />
                                <vsm:VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" 
                                                         To="{StaticResource OpacityDisable}" Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="FocusStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="0" />
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Unfocused" />
                                <vsm:VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Focus"
                                                                       Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <!-- Background -->
                        <Rectangle Fill="{TemplateBinding Background}" StrokeThickness="0" />

                        <!-- Horizontal Template -->
                        <Grid x:Name="HorizontalTemplate" Height="10">
                            <StackPanel Height="6" VerticalAlignment="Center">
                                <Rectangle Height="1" Margin="1" Width="10" StrokeThickness="0" Fill="{StaticResource Brush1}" />
                                <Rectangle Height="1" Margin="1" Width="10" StrokeThickness="0" Fill="{StaticResource Brush1}" />
                            </StackPanel>
                        </Grid>

                        <!-- Vertical Template -->
                        <Grid x:Name="VerticalTemplate" Visibility="Collapsed" Width="10">
                            <StackPanel Width="6" VerticalAlignment="Center" Orientation="Horizontal">
                                <Rectangle Width="1" Margin="1" Height="10" StrokeThickness="0" Fill="{StaticResource Brush1}" />
                                <Rectangle Width="1" Margin="1" Height="10" StrokeThickness="0" Fill="{StaticResource Brush1}" />
                            </StackPanel>
                        </Grid>

                        <Border x:Name="Focus" BorderThickness="2" CornerRadius="3" 
                                BorderBrush="{StaticResource Brush15}" Margin="0" Visibility="Collapsed"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
